<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PesonMedicationsList.aspx.cs" Inherits="Meditek.UI.PesonMedicationsList" MasterPageFile="~/MasterPage.Master"%>
<%@ Register src="../../Controls/SearchUserControl.ascx" tagname="SearchUserControl" tagprefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="server">
		<uc1:SearchUserControl ID="ucSearch" runat="server" /> 
		<br />
		<table>
		  <tr>
		    <td><asp:Button ID="btnInsert" runat="server" CausesValidation="True" Text="Add New PesonMedications" onclick="btnInsert_Click" CssClass="Button" /></td>
 			<td><asp:Button ID="btnDelete" runat="server" CausesValidation="True" Text="Delete" onclick="btnDelete_Click" CssClass="Button" /></td>
		  </tr>
		</table>
		<asp:GridView ID="gvPesonMedications" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
            GridLines="None" Width="100%" DataSourceID="PesonMedicationsDataSource"  
            DataKeyNames="idPersonMedication" onrowcommand="gvPesonMedications_RowCommand" 
            CssClass="grid">
            <PagerSettings FirstPageText="First Page" LastPageText="Last Page" 
                PageButtonCount="3" Mode="NumericFirstLast" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="#FF7474" Font-Bold="True" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
               <asp:TemplateField>
                 <ItemTemplate>
                 <table>
                 <tr>
					<td>
						<asp:HyperLink ID="lnkEditRecord" CommandName="Edit"  runat="server"  NavigateUrl='<%# Eval("idPersonMedication","~/Pages/PesonMedications/PesonMedicationsForm.aspx?mode=Edit&idPersonMedication={0}") %>'>
						<img src="../../Content/Images/Edit.gif" alt="Edit" style="border:0;" />
						</asp:HyperLink>
					</td>
					<td>	
						<asp:LinkButton  ID="lnkDeleteRecord" CommandName="Delete"  runat="server"   OnClientClick="return confirm('Are you sureyou want to delete this record?');">
						<img src="../../Content/Images/Delete.gif" alt="Delete" style="border:0;" />
						</asp:LinkButton >
					</td>
					<td>
						<asp:CheckBox ID="chkSelect" Runat="server" />
					</td>
				 </tr>
				 </table>
                 </ItemTemplate>
               </asp:TemplateField>
			   <asp:BoundField HeaderText="id Person Medication" SortExpression="idPersonMedication" DataField="idPersonMedication" />
			   <asp:BoundField HeaderText="End Date" SortExpression="EndDate" DataField="EndDate" />
			   <asp:BoundField HeaderText="How Many" SortExpression="HowMany" DataField="HowMany" />
			   <asp:BoundField HeaderText="How Often" SortExpression="HowOften" DataField="HowOften" />
			   <asp:TemplateField HeaderText ="Name" SortExpression = "Medication">
				 <ItemTemplate>
				   <asp:Label ID="lblMedication" runat="server" Text='<%#referenceConverter.Convert(Eval("Medication"),"Medications") %>' />
				 </ItemTemplate>
			   </asp:TemplateField>
			   <asp:BoundField HeaderText="Obs" SortExpression="Obs" DataField="Obs" />
			   <asp:TemplateField HeaderText ="id Person" SortExpression = "Person">
				 <ItemTemplate>
				   <asp:Label ID="lblPerson" runat="server" Text='<%#referenceConverter.Convert(Eval("Person"),"Persons") %>' />
				 </ItemTemplate>
			   </asp:TemplateField>
			   <asp:BoundField HeaderText="Star Date" SortExpression="StarDate" DataField="StarDate" />
			   <asp:TemplateField HeaderText ="Name" SortExpression = "Status">
				 <ItemTemplate>
				   <asp:Label ID="lblStatus" runat="server" Text='<%#referenceConverter.Convert(Eval("Status"),"_Status") %>' />
				 </ItemTemplate>
			   </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
    <asp:ObjectDataSource ID="PesonMedicationsDataSource" runat="server" 
        SelectMethod="Find" TypeName="Meditek.UI.PesonMedicationsReference.PesonMedicationsServiceClient" 
        DataObjectTypeName="Meditek.Entities.PesonMedications" DeleteMethod="Delete" 
        onobjectcreated="PesonMedicationsDataSource_ObjectCreated" 
        ondeleted="PesonMedicationsDataSource_Deleted">
        <SelectParameters>
            <asp:Parameter DefaultValue=""	Name="conditionString" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
